package vn.com.epi.log.Import;

public class UserRecord implements Comparable<UserRecord> {
	
	private int articleId;
	private long timestamp;

	public UserRecord() {
		
	}
	
	public UserRecord(int articleId, long timestamp) {
		setArticleId(articleId);
		setTimestamp(timestamp);
	}

	public UserRecord(String logLine) {
		String[] chunks = logLine.split(",");
		timestamp = Long.parseLong(chunks[0]);
		articleId = Integer.parseInt(chunks[3]);
	}

	public int getArticleId() {
		return articleId;
	}

	public void setArticleId(int articleId) {
		this.articleId = articleId;
	}

	public long getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}

	@Override
	public int compareTo(UserRecord o) {
		if (timestamp > o.getTimestamp())
			return -1;
		else
			if (timestamp < o.getTimestamp())
				return 1;
		return 0;
	}
}